package com.ftx.controller.test.annotation.importTest;

import org.springframework.beans.factory.FactoryBean;

/**
 * Created by fengtingxin on 2020/4/15.
 * 创建一个spring定义的工厂bean
 */

public class ColorFactory implements FactoryBean {

    @Override
    public Object getObject() throws Exception {
        System.out.println("getObject is color");
        return new Color();
    }

    /**
     * 获取bean的类型
     * @return
     */
    @Override
    public Class<?> getObjectType() {
        return Color.class;
    }

    /**
     * 是否单例
     * @return
     */
    @Override
    public boolean isSingleton() {
        return true;
    }
}
